<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>升级为医生</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="format-detection" content="telephone=no"/>
<meta name="format-detection" content="email=no"/>
<meta name="format-detection" content="address=no"/>
<link href="__PUBLIC__/css/base.css" rel="stylesheet"/>
</head>
<body class="huibg">
<!---  头部开始  -->
<div class="top clearfix">
	<div class="icon_left"></div>
	<div class="icon_right"></div>
</div>
<!---  头部结束  -->
<div class="up_doctor cssss">
	<div class="title">请填写以下信息</div>
	<table class="tab_01">
		<tr>
			<td>姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：</td>
			<th><input type="text" name="name" placeholder="李国桥"></th>
			<td class="size3"><span>*</span> 必填</td>
		</tr>
		<tr>
			<td>工作单位：</td>
			<th><input type="text" name="hospital" placeholder="北京大学口腔医学院"></th>
			<td class="size3"><span>*</span> 必填</td>
		</tr>
		<tr>
			<td>工作科室：</td>
			<th>
				<input class="department" type="text" name="department" placeholder="请选择科室" readonly="readonly" />
				<!--
				<select name="department" class="selsect1">
					<volist name="department" id="vo">
						<option value="{$vo.name}">{$vo.name}</option>
					</volist>
				</select>
				-->
			</th>
			<td><i class="jiantou4"></i></td>
		</tr>
		<tr>
			<td>职&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称：</td>
			<th><input type="text" name="position" placeholder="无"></th>
			<td></td>
		</tr>
		<tr>
			<td>社会职称：</td>
			<th><input type="text" name="socialposition" placeholder="无"></th>
			<td></td>
		</tr>
		<tr>
			<td>手&nbsp;&nbsp;机&nbsp;号：</td>
			<th><input type="text" name="mobile" placeholder="15369426812" maxlength="11"></th>
			<td class="size3"><span>*</span> 必填</td>
		</tr>
		<tr>
			<td>验&nbsp;&nbsp;证&nbsp;码：</td>
			<th><input type="text" class="yzm" name="smscode"></th>
			<td><a class="time2 yanzhengma">获取</a></td>
		</tr>
	</table>
	<div class="texcen">
		<a class="tijiao">提 交</a>
	</div>
</div>
<!---  统一样式浮层开始  -->
<div class="fc_box none">
	<div class="fcBox_bg"></div>
	<div class="fcBox_text">
		<dl>
			<dt>选择工作科室：<span class="close3" onclick="close3(this);"></span></dt>
			<volist name="department" id="vo">
				<dd>{$vo.name}</dd>
			</volist>
		</dl>
	</div>
</div>
<!---  统一样式浮层结束  -->
</body>
<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/comm.js"></script>
<script>
var name1;
var hospital1;
var department1;
var position1;
var socialposition1;
var mobile1;
var smscode1;

//选择科室
$(".department,.jiantou4").click(function(){
	$(".fc_box").removeClass("none");
});
$(".fc_box dd").click(function(){
	$(".department").val($(this).html());
	$(".fc_box").addClass("none");
});
function check(){
	name1=$.trim($(".up_doctor input[name='name']").val());
	hospital1=$.trim($(".up_doctor input[name='hospital']").val());
	department1=$.trim($(".up_doctor input[name='department']").val());
	position1=$.trim($(".up_doctor input[name='position']").val());
	socialposition1=$.trim($(".up_doctor input[name='socialposition']").val());
	mobile1=$.trim($(".up_doctor input[name='mobile']").val());
	smscode1=$.trim($(".up_doctor input[name='smscode']").val());
	
	if((name1.length<1) || (name1.length>5)){
		alert("请正确输入姓名");
		return false;
	}
	//alert(hospital1);
	var myReg = /^[\u4e00-\u9fa5]+$/;
	if(hospital1.length<1 || !myReg.test(hospital1)){
		alert("请正确输入工作单位");
		return false;
	}
	if (position1.length<1) {
		position1="无";
	}
	if (socialposition1.length<1) {
		socialposition1="无";
	}
	if(department1.length<1){
		alert("请选择工作科室");
		return false;
	}
	/*
	var isMobile=/^(?:13\d|15\d|18\d)\d{5}(\d{3}|\*{3})$/;
	if((mobile1.length<1) || !isMobile.test(mobile1)){
		alert("请正确输入手机号码");
		return;
	}
	*/
	if(smscode1.length<1 || isNaN(smscode1)){
		alert("请输入验证码");
		return false;
	}

}
$(function  () {
	//获取验证码
	var validCode=true;
	$(".yanzhengma").click(function(ev){
		var isMobile=/^(?:13\d|15\d|18\d)\d{5}(\d{3}|\*{3})$/;
		mobile1=$.trim($(".up_doctor input[name='mobile']").val());
		if((mobile1.length<1) || !isMobile.test(mobile1)){
			alert("请正确输入手机号码");
			return;
		}
		if(validCode) {
			$.post("__URL__/getVerifyCode",{
				mobile:mobile1,
			},function(e){
		        if(e.status==1){
		            var time=60;				
					if (validCode) {
						validCode=false;
						var t=setInterval(function  () {
							time--;					
							$(".time2").html(time+"秒");
							$(".time2").removeClass("yanzhengma");
							if (time<=0) {
								clearInterval(t);
								$(".time2").html("获取");
								$(".time2").addClass("yanzhengma");
								validCode=true;
							}
						},1000)
					}
		        }else{
		            alert(e.msg);
		        }
		    });
		}
	});
});
//提交
$(".tijiao").click(function(){
	if(check()==false){

	}else{
		$.post("__URL__/up_doctor",{
			name:name1,
			hospital:hospital1,
			department:department1,
			position:position1,
			socialposition:socialposition1,
			mobile:mobile1,
			smscode:smscode1,
		},function(e){		 
			if(e.status==1){
				alert("升级成功");
				window.location="__URL__/person_info4_edit";
			}else{
				alert(e.msg);
			}
		});
	}
	
});

</script>
</html>